def register(active=True):
    def decorate(func):
        def inner(*args, **kwargs):
            print('before..')
            ret = func(*args, **kwargs)
            print('after')
            print('activate is' + str(active))
            return ret
        return inner
    return decorate

@register(active=False)
def f():
    pass

# @register()
def f2():
    pass

if __name__ == '__main__':
    register()(f2)()